﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="EditQuizQuestion.aspx.vb" Inherits="Assignment4.EditQuizQuestion" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>Edit Questions</h1>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        CellPadding="4" DataKeyNames="Quiz_QuestionId" 
        DataSourceID="SqlDataSourceQuizQuestions" ForeColor="#333333" 
        GridLines="None" Width="320px">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
        <asp:TemplateField>
         <HeaderTemplate>
          Index
         </HeaderTemplate>
          <ItemTemplate>
        <%# getIndex()%>
          </ItemTemplate>
        </asp:TemplateField>

            <asp:BoundField DataField="Quiz_QuestionContent" HeaderText="Content" 
                SortExpression="Quiz_QuestionContent" />
             <asp:TemplateField>
             <ItemTemplate>
               <img class="gridpicture" src="<%# getPicture(Eval("Quiz_QuestionPictureUrl"))%>" />
                  
             </ItemTemplate> 
            </asp:TemplateField>
           <asp:HyperLinkField DataNavigateUrlFields="QuizId,Quiz_QuestionId" 
                DataNavigateUrlFormatString="EditQuizQuestion.aspx?QuizId={0}&amp;QuizQuestionId={1}" 
                Text="Edit Question" />
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceQuizQuestions" runat="server" 
        ConnectionString="<%$ ConnectionStrings:learningConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:learningConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [Quizes_Questions] WHERE ([QuizId] = ?)" 
        EnableViewState="False">
        <SelectParameters>
            <asp:QueryStringParameter Name="QuizId" QueryStringField="QuizId" 
                Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    <br />
<asp:Button ID="btnAddAnotherQuestion" runat="server" 
    Text="Add Another Question" />
<br />
    
    <asp:Panel ID="pnlFields" runat="server">
        
       <table class="style1">
        <tr>
            <td class="style2">
                Question</td>
            <td>
                <asp:TextBox ID="txtQuestion" runat="server" Height="35px" 
                    style="margin-left: 0px" TextMode="MultiLine" Width="685px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="txtQuestion" CssClass="lblmessage" 
                    ErrorMessage="Enter Question" ValidationGroup="update">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2">
                Possible Answer 1</td>
            <td>
                <asp:TextBox ID="txtPossibleAnswer1" runat="server" Width="300px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtPossibleAnswer1" CssClass="lblmessage" 
                    ErrorMessage="Enter Possible Answer 1" ValidationGroup="update">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2">
                Possible Answer 2</td>
            <td>
                <asp:TextBox ID="txtPossibleAnswer2" runat="server" Width="300px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="txtPossibleAnswer2" CssClass="lblmessage" 
                    ErrorMessage="Enter Possible Answer 2" ValidationGroup="update">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2">
                Possible Answer 3</td>
            <td>
                <asp:TextBox ID="txtPossibleAnswer3" runat="server" Width="300px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="txtPossibleAnswer3" CssClass="lblmessage" 
                    ErrorMessage="Enter Possible Answer 3" ValidationGroup="update">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2">
                Possible Answer 4</td>
            <td>
                <asp:TextBox ID="txtPossibleAnswer4" runat="server" Width="300px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="txtPossibleAnswer4" CssClass="lblmessage" 
                    ErrorMessage="Enter Possible Answer 4" ValidationGroup="update">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2">
                Correct Answer
            </td>
            <td>
                <asp:DropDownList ID="drpPossibleAnswers" runat="server">
                    <asp:ListItem Value="Quiz_QuestionPossibleAnswer1">Possible Answer1</asp:ListItem>
                    <asp:ListItem Value="Quiz_QuestionPossibleAnswer2">Possible Answer 2</asp:ListItem>
                    <asp:ListItem Value="Quiz_QuestionPossibleAnswer3">Possible Answer 3</asp:ListItem>
                    <asp:ListItem Value="Quiz_QuestionPossibleAnswer4">Possible Answer 4</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style2">
&nbsp;Answer Explenation</td>
            <td style="margin-left: 80px">
                <asp:TextBox ID="txtAnswerExplenation" runat="server" Height="55px" 
                    style="margin-left: 0px; margin-bottom: 0px;" TextMode="MultiLine" 
                    Width="688px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                    ControlToValidate="txtAnswerExplenation" CssClass="lblmessage" 
                    ErrorMessage="Enter Answer Explenation" ValidationGroup="update">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style2">
                Picture
            </td>
            <td style="margin-left: 80px">
                <asp:FileUpload ID="fuPictureUrl" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td style="margin-left: 80px">
                &nbsp;</td>
        </tr>
           <tr>
               <td class="style2">
                   &nbsp;</td>
               <td style="margin-left: 80px">
                   <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                       CssClass="lblmessage" ValidationGroup="update" />
               </td>
           </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td style="margin-left: 80px">
                <asp:Button ID="btnAddQuestion" runat="server" Text="Update Question" 
                    Width="159px" ValidationGroup="update" />
            </td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td style="margin-left: 80px">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style2">
                &nbsp;</td>
            <td style="margin-left: 80px">
                <asp:Label ID="lblMessage" runat="server"></asp:Label>
            </td>
        </tr>
    </table>
        </asp:Panel>
</asp:Content>
